<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="bp" value="${pageContext.request.contextPath}"></c:set>
<!DOCTYPE html>
<html lang="en">

<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>蓝天洗衣店</title>

    <!-- Bootstrap Core CSS -->
    <link href="${bp}/static/admin/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link href="${bp}/static/admin/vendor/metisMenu/metisMenu.min.css" rel="stylesheet">

    <!-- Custom CSS -->
    <link href="${bp}/static/admin/dist/css/sb-admin-2.css" rel="stylesheet">

    <!-- Custom Fonts -->
    <link href="${bp}/static/admin/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>

<body style="position: relative;width:100%;height:100%;">
    <img src="${bp}/static/admin/img/header.jpg" alt="" style="position: absolute;width:100%;">
    <div class="container">

        <div class="row">
            <div class="col-md-6 col-md-offset-3">
                <div class="login-panel panel panel-default">
                    <!-- <div class="panel-heading"> -->
                        <!-- <h3 class="panel-title">注册</h3> -->
                    <!-- </div> -->
                    <h1 style="text-align:center;font-size:5rem;">注册</h1>
                    <div class="panel-body">
                        <form role="form" action="${bp}/adminUser/add" method="post" id="user">
                            <fieldset>
                                <div class="form-group">
                                    <input class="form-control" placeholder="请输入用户名" name="username" type="text" autofocus>
                                </div>
                                <div class="form-group">
                                        <input class="form-control" placeholder="请输入名字" name="name" type="text" value="">
                                    </div>
                                <div class="form-group">
                                    <input class="form-control" placeholder="请输入密码" name="password" type="password" value="">
                                </div>
                                <div class="form-group">
                                        <input class="form-control" placeholder="请输入地址" name="addr" type="text" value="">
                                    </div>
                                    <div class="form-group">
                                            <input class="form-control" placeholder="请输入手机号" name="phone" type="number" value="">
                                        </div>
                                <div class="checkbox">
                                    <!-- <label> -->
                                        <p>已有帐号，请点击 <a href="${bp}/admin/adminLogin">登录</a></p>
                                    <!-- </label> -->
                                </div>
                                <button  type="submit" class="btn btn-lg btn-success btn-block"  >注册</button>
                            </fieldset>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- jQuery -->
    <script src="${bp}/static/assets/js/jquery-3.2.1.min.js"></script>

    <!-- Bootstrap Core JavaScript -->
    <script src="${bp}/static/admin/vendor/bootstrap/js/bootstrap.min.js"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script src="${bp}/static/admin/vendor/metisMenu/metisMenu.min.js"></script>

    <!-- Custom Theme JavaScript -->
    <script src="${bp}/static/admin/dist/js/sb-admin-2.js"></script>

</body>
<script type="text/javascript">
    function add() {
        $.ajax({
            type: "POST",
            url: "${bp}/user/add",
            data: $('#user').serialize(),
            success: function (msg) {
                alert(msg)
                if (msg == "1") {
                    alert("添加成功");
                    <%--window.location.href="${bp}/user/adminLogin"--%>
                } else {
                    alert("添加失败")
                    return false;
                }
            }
        });
    }
</script>
</html>
